Skip to content

Conversation

@BenedekFarkas
Copy link
Member

Fixes #8232

@BenedekFarkas BenedekFarkas self-assigned this Nov 27, 2024
@BenedekFarkas BenedekFarkas linked an issue Nov 27, 2024 that may be closed by this pull request
Comment on lines 212 to 213
// Iterate over each filter group, but ignore empty ones, because they'd cause all content items to be returned.
foreach (var group in queryRecord.FilterGroups.Where(group => group.Filters.Count > 0)) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only functional change, the rest is just code styling and comment rephrasing.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am suggesting adding a limit filter instead (100, 500). And add a notification.

Copy link
Member Author

@BenedekFarkas BenedekFarkas Dec 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't find a suitable way to apply such a limit due to how the query is constructed (there is no explicit limit filter) without hurting the abstractions. It is possible to intervene towards the end of the query evaluation when Slice is called (and apply a limit there), but that would mess up paging.
I added a notification instead, when a Query or a ProjectionPart is saved, IMO that's good enough.

@BenedekFarkas BenedekFarkas added this to the Orchard 1.10.4 milestone Dec 9, 2024
@BenedekFarkas BenedekFarkas changed the title #8232: Fixing that an empty Projection Query shouldn't list all content items #8232: Adding warnings when a Projection Query has an empty Filter Group Dec 10, 2024
@BenedekFarkas BenedekFarkas merged commit d26e8e4 into 1.10.x Jan 14, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Projections: Empty Query returns every content item

3 participants